package com.systop.busafter.location.mapper;

import com.systop.commer.pojo.Location;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface LocationMapper {
    /*
     * id修改location
     * location location
     * return int
     * csh
     *
     * */
    @Update("update location set location_driver_id = #{location_driver_id},location_longitude = #{location_longitude},location_latitude = #{location_latitude} ,location_state = #{location_state}" +
            ",location_remarks = #{location_remarks},location_s = #{location_s}where location_id = #{location_id}")
    int updatalocation(Location location);

    /*
     *通过司机id修改状态
     * location location
     * return int
     * csh
     * */
    @Update("update location set location_state = #{location_state} where location_driver_id = #{location_driver_id}")
    int uplocationdriver(Location location);

    //"time = #{time,jdbcType=TIMESTAMP} "  时间类型

    /*
     * 添加location
     * location location
     * return int
     * csh
     * */
    @Insert("insert into location(location_driver_id,location_longitude,location_latitude,location_state,location_remarks,location_s) " +
            "values (#{location_driver_id},#{location_longitude},#{location_latitude},#{location_state},#{location_remarks},#{location_s})")
    int insertlocation(Location location);


    /*
     * 查看全部
     * 无
     * list
     * csh
     * */
    @Select("select * from location")
    List<Location> locationListall();

    /*
     * 用id查看location
     * location_id  int
     * list
     * csh
     * */
    @Select("select * from location where location_id = #{location_id}")
    List<Location> locationIdlist(int location_id);

    /*
     * 用id查看location
     * location_id  int
     * 实体类
     * csh
     * */
    @Select("select * from location where location_id = #{location_id}")
    Location LocationId(int location_id);
    /*
     * 删除location
     * location_id  int
     * return int
     * csh
     * */
    @Delete("delete from location where location_id=#{location_id}")
    int deletelocation(int location_id);

    /*
     * 通过司机id查
     * location_id  int
     * list
     * csh
     * */
    @Select("select * from location where location_driver_id = #{location_driver_id}")
    List<Location> locationdriverid(int location_driver_id);

    /*
     * 通过司机id,状态查
     * location_id  int
     * list
     * csh
     * */
    @Select("select * from location where location_driver_id = #{location_driver_id} and location_state = #{location_state}")
    List<Location> locationdriverids(Location location);

}
